Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

11532: Duplicate Simple Product Throws Error: Undefined offset: 0 in SaveHandler.php on line 122 #12001

Merged
merged 2 commits into from Nov 13, 2017

Conversation

RomaKis
Copy link
Contributor

@RomaKis RomaKis commented Nov 3, 2017

Fixed Issues (if relevant)

  1. Duplicate Simple Product Throws Error: Undefined offset: 0 in SaveHandler.php on line 122 #11532: Duplicate Simple Product Throws Error: Undefined offset: 0 in SaveHandler.php on line 122

Manual testing scenarios

Precondition
Two cases:
Create simple product and export his, delete product in catalog manager, and import file from product.
or
Create simple product, and update Magento from 2.1.8 or 2.1.9 to 2.2.0.
Steps to reproduce:

  1. Click on an existing simple product in the catalog manager
  2. Click the "Save & Duplicate" option
    Expected result
    The product saves and creates a duplicate item.
    Actual result
    Saves the product but doesn't duplicate it. Throws the following error:
    Notice: Undefined offset: 0 in /home/store/public_html/vendor/magento/module-catalog/Model/Category/Link/SaveHandler.php on line 122

Contribution checklist

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds on Travis CI are green)

@magento-engcom-team magento-engcom-team added 2.2.x Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release labels Nov 7, 2017
@dmanners dmanners self-assigned this Nov 10, 2017
@dmanners dmanners added this to the November 2017 milestone Nov 10, 2017
} elseif ($oldCategoryPositions[$key]['position'] != $newCategoryPosition['position']) {
$result[] = $newCategoryPositions[$key];
unset($oldCategoryPositions[$key]);
} elseif (isset($oldCategoryPositions[$key])) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally I do not think we need the nested if here. I think we could cover this check via

} elseif (
    isset($oldCategoryPositions[$key])
    && $oldCategoryPositions[$key]['position'] != $newCategoryPosition['position']
) {

Or have I missed something?

Copy link
Contributor Author

@RomaKis RomaKis Nov 10, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dmanners, yes, you are right. It is fixed and squashed.

@dmanners
Copy link
Contributor

@RomaKis There appears to be a small style problem.


There was 1 failure:
--
10-Nov-2017 05:50:34 | [exec]
10-Nov-2017 05:50:34 | [exec] 1) Magento\Test\Php\LiveCodeTest::testCodeStyle
10-Nov-2017 05:50:34 | [exec] PHP Code Sniffer detected 2 violation(s):
10-Nov-2017 05:50:34 | [exec]
10-Nov-2017 05:50:34 | [exec] FILE: ...to2/app/code/Magento/Catalog/Model/Category/Link/SaveHandler.php
10-Nov-2017 05:50:34 | [exec] ----------------------------------------------------------------------
10-Nov-2017 05:50:34 | [exec] FOUND 1 ERROR AFFECTING 1 LINE
10-Nov-2017 05:50:34 | [exec] ----------------------------------------------------------------------
10-Nov-2017 05:50:34 | [exec]  122 \| ERROR \| [x] Expected 0 spaces after opening bracket; newline
10-Nov-2017 05:50:34 | [exec]      \|       \|     found
10-Nov-2017 05:50:34 | [exec] ----------------------------------------------------------------------
10-Nov-2017 05:50:34 | [exec] PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
10-Nov-2017 05:50:34 | [exec] ----------------------------------------------------------------------

@RomaKis
Copy link
Contributor Author

RomaKis commented Nov 10, 2017

@dmanners, fixed.

@dmanners
Copy link
Contributor

@RomaKis thanks

@okorshenko okorshenko merged commit 3f79b80 into magento:2.2-develop Nov 13, 2017
okorshenko pushed a commit that referenced this pull request Nov 13, 2017
@magento-engcom-team magento-engcom-team added the Fixed in 2.2.x The issue has been fixed in 2.2 release line label Nov 13, 2017
@testmagento2
Copy link

@dmanners, fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Fixed in 2.2.x The issue has been fixed in 2.2 release line Progress: accept Release Line: 2.2 Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants